//
//  ChildTagController.m
//  Wy_BuyBooks
//
//  Created by wangyang on 2020/2/6.
//  Copyright © 2020 wangyang. All rights reserved.
//

#import "ChildTagController.h"
#import "ChildNavigation.h"
#import "HomeViewController.h"
#import "BuyBooksViewController.h"
#import "OrderViewController.h"
#import "MyViewController.h"
@interface ChildTagController ()

@end

@implementation ChildTagController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    HomeViewController   *home = [[HomeViewController alloc]init];
    home.view.backgroundColor = [UIColor whiteColor];
    [self addChildVC:home image:@"书本备份" selectedImage:@"书本" title:@"首页"];
    
    
    BuyBooksViewController   *  Classification = [[BuyBooksViewController alloc]init];
    Classification.view.backgroundColor = UIColorFromRGB(0xF8F8F8);
    [self addChildVC:  Classification image:@"卖书备份" selectedImage:@"卖书" title:@"我要卖书"];
    
    OrderViewController   *  OrderView = [[OrderViewController alloc]init];
    OrderView.view.backgroundColor = WyWhiteColor;
    [self addChildVC:  OrderView image:@"我的订单备份" selectedImage:@"我的订单" title:@"我的订单"];
    
    MyViewController   *my = [[MyViewController alloc]init];
    my.view.backgroundColor = WyWhiteColor;
    [self addChildVC:my image:@"个人中心备份" selectedImage:@"个人中心" title:@"个人中心"];
}
-(void)addChildVC:(UIViewController*)vc image:(NSString*)imgage selectedImage:(NSString *)selectedImage title:(NSString *)title
{
    ChildNavigation *Nav=[[ChildNavigation alloc]initWithRootViewController:vc];
    [self addChildViewController:Nav];
    
    vc.tabBarItem.image=[UIImage imageNamed:imgage];
    vc.tabBarItem.selectedImage=[[UIImage imageNamed:selectedImage]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    vc.tabBarItem.title=title;
    vc.title=title;
    [vc.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor grayColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
    [vc.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:UIColorFromRGB(0xFADB14),NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
    
    
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
